


jsbHelper = """

import { sys } from "cc";
import { DEBUG } from "cc/env";

/**
 * 
 * JSBHelper类 
 * 
 * 重要函数
 * @function newGAEvent 发送新的事件
 * @function startGame 发送一个开始游戏的事件 （GA案例）
 * 
 * @author Geek7
 */
export class JSBHelper {


    static readonly ANDROID_ACTIVITY_FULL_NAME = "com/cocos/game/AppActivity";
    static reflector(
        method: string,
        argtype: string,
        ...parapms: any[]
    ): any {

        if (DEBUG) return;

        if (sys.os == sys.OS_ANDROID) {

            return jsb.reflection.callStaticMethod(
                JSBHelper.ANDROID_ACTIVITY_FULL_NAME,
                method,
                argtype,
                ...parapms
            );
        }
        else if (sys.os == sys.OS_IOS) {
            return jsb.reflection.callStaticMethod(
                "AppController",
                method,
                argtype,...parapms);
        }
        return null;
    }

    static newGAEvent(event: string, msg: object) {


        JSBHelper.reflector(
            "GAEvent",
            "(Ljava/lang/String;Ljava/lang/String;)V",
            event,
            JSON.stringify(msg)
        );
    }


    /** ---------------------------安卓 GA 案例 -------------------------------------- */
    //开始游戏事件
    static startGame(){

        JSBHelper.newGAEvent(
            "start-game",   //事件名称
            {
                "time": new Date().toUTCString()  //键值对  Json对象作为参数传递
            }
        );
    }

}



"""